//
// Created by Administrator on 2024/10/29.
//

#ifndef AI_PACS_AWSS3CLIENT_H
#define AI_PACS_AWSS3CLIENT_H

#define ACCESS_KEY_ID "AGNO7WI5EPKOHMVFBFLW"
#define SECRET_ACCESS_KEY "abVpdBhoDU699eoLi4Rrv6Y13ExX2jANx9rB9ns1"

#include <iostream>
#include <aws/s3/S3Client.h>
#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <tabulate/table.hpp>
#include "Configuration.h"
#include <aws/s3/model/PutObjectRequest.h>
#include <fstream>
#include "Coroutine.h"
#include "DcmToolkit.h"
#include <coroutine>
#include <nlohmann/json.hpp>
#include <memory>


using json = nlohmann::json;

class AwsS3Client {
private:
    Aws::S3::S3Client s3_client_;
    Aws::SDKOptions options_;
    std::string ak;
    std::string sk;
    std::string region;
    std::string endpoint;
    std::string bucketName;
public:
    AwsS3Client();

    void ListS3Buckets();

    std::string UploadToS3(const Aws::String &objectKey, const Aws::String &filePath);

    static Promise<std::string> Gather(std::vector<std::map<std::string, std::string>> &files);

    static std::vector<std::string> Executor(std::vector<std::map<std::string, std::string>> &files);

    std::string UploadJsonToS3(const std::string &objectKey, const json &jsonData);
};

#endif //AI_PACS_AWSS3CLIENT_H
